import config from './config.js';

/*
	发送网络请求
	@param   url  地址
			 data  参数   {id:100,username:'张三'}
			method  方法：GET|POST
			token	
*/
function http(url = "", data = {}, method = "GET",token="") {
	return new Promise((resolve, reject) => {
		uni.request({
			url: config.baseUrl + url,
			method: method,
			data: data,
			header: {
				authorization: token,
				'content-type': 'application/x-www-form-urlencoded'
			},
			success: res => {
				resolve(res)
			},
			fail: err => {
				reject(err)

			}
		})
	})
}

export {
	http
}
